/*3:修改前面老师那题：
老师有年龄，学校，姓名的属性，有上课和自我介绍的方法，如果年龄少于22岁，抛出异常。
*/
package Work0518;

public class Teacher {
	private int old;
	private String school;
	private String name;

	public Teacher(int old, String school, String name) {
		this.old = old;
		this.school = school;
		this.name = name;
	}

	public void introduce() throws Exception {
		System.out.println("我叫" + name + ",来自" + school + ",今年" + old + "岁.");
		if (old < 22) {
			throw new Exception("年龄不能低于22");
		}
	}

	public void attendClass() {
		System.out.println(name + "正在上课");
	}

}
